﻿@using MyBlog2.Models
@using MyBlog2.ViewModels
@model List<MyBlog2.Models.Article>

@{
    ViewData["Title"] = "搜索";
    Layout = "~/Areas/Admin/Views/Shared/_AdminLayout.cshtml";

    int count = Convert.ToInt32(ViewBag.resultCount);
}

<h1>搜索结果</h1>
<br />


<!-- 表格 -->
<div class="table-responsive">
    <table class="table table-bordered table-hover">
        <caption>
            <p>共 <span style="color: orange">@count</span> 条</p>
        </caption>
        <thead class="thead-light">
            <tr>
                <th scope="col">序号</th>
                <th scope="col">标题</th>
                <th scope="col">类型</th>
                <th scope="col">是否发布</th>
                <th scope="col">更新时间</th>
                <th scope="col">操作</th>
            </tr>
        </thead>
        <tbody>
            @for (int i = 0; i < Model.Count; i++)
            {
                <tr>
                    <th scope="row">@(i+1)</th>
                    <td>@Model[i].Title</td>
                    <td>@Model[i].ArticleClassify.Name</td>
                    <td>@(Model[i].Published ? "是" : "否")</td>
                    <td>@Model[i].UpdateTime</td>
                    <td>
                        <a class="btn btn-info" asp-route="EditArticle" asp-route-id="@Model[i].Id">编辑</a>

                        <a class="btn btn-danger" asp-route="DeleteArticle" asp-route-id="@Model[i].Id">删除</a>

                    </td>
                </tr>
            }
        </tbody>

    </table>
</div>